The wide use of Internet and the maturity of Internet technologies make it possible to transmit traditional Fax information over Internet. Accordingly, IP Fax-related technologies emerge as the times require. According to real-time attributes, IP Fax may be divided into Store-Forward IP Fax and Real-time IP Fax. According to gateway processing modes, the Real-time IP Fax may be further divided into pass-through mode and T.38 mode. The pass-through mode is not widely used due to its poor network damage resistance. A T.38 Real-time IP Fax gateway mainly serves to process T.38 protocol and Data Pump (DP) modulation and demodulation, whose system structure is illustrated as in FIG. 1. The essential principle of T.38 IP Fax lies in that: a T.38 gateway demodulates the data sent by a facsimile machine, packs the demodulated payload data into an IP packet specified in T.38 protocol, and sends the IP packet to an opposite gateway via IP network; the receiving-party T.38 gateway parses the payload data from the IP packet according to the information attribute of the IP packet, remodulates and sends it to the TDM-side (which refers to the side on which the gateway is connected with the PSTN, such as the side on which gateway 1 is connected with facsimile machine 1 and the side on which gateway 2 is connected with facsimile machine 2 as shown in FIG. 1, and which is called “the TDM side” hereunder) facsimile machine. Thus, it can be seen that, it is Fax signaling or messages exchanged between two terminal facsimile machines that are carried by Real-time IP Fax, and the two terminal facsimile machines communicate with each other in real-time following a Fax process conforming to T.30 protocol. A typical Fax process is shown in FIG. 2.
Usually, a Voice over IP (VOIP) gateway not only supports Fax service, but also supports voice service. The gateway is initially in voice state, and is switched to be in T.38 Fax service state when a Fax event is detected; and when a fax end event is detected, the gateway switches from T.38 Fax state back to voice state, so as to enable a normal voice communication after the Fax. In an NGN network in which the switching between Fax and voice is controlled via Soft Switch, when either of the two gateways in the two sides detects a Fax event, the gateway reports the Fax event to the Soft Switch, and the Soft Switch notifies the two gateways to switch to Fax state via signaling; and correspondingly, when either of the two gateways detects a fax end event, the gateway reports the fax end event to the Soft Switch, and the Soft Switch issues a command to control the gateways to switch from Fax state back to voice state. In T.30 protocol, it is specified that there are two situations for fax end: in one situation, either of the facsimile machines sends a DCN signal to notify the opposite facsimile machine, and the Fax terminates; and in the other situation, exception occurs on the Fax, and the facsimile machine does not send a DCN. Instead, it disconnects the signaling directly. This document focuses on how to reliably detect a fax end event and how to ensure the detecting and switching of a gateway not to influence the reception of the DCN signal by the terminal facsimile machines in the first situation. As shown in FIG. 2, the Fax process successfully proceeds to stage E, and the sending facsimile machine successfully sends a Fax page and then sends a DCN signal to the receiving facsimile machine. If the receiving facsimile machine cannot receive a valid DCN signal, it may consider that the Fax terminates abnormally and send out an alarm sound, which will mislead the Fax user into thinking that the Fax fails, but in fact, the receiving facsimile machine has successfully received the correct Fax page. For convenience in the following context, the facsimile machines and gateway are defined as follows: a sending facsimile machine refers to a facsimile machine that sends a DCN signal, a receiving facsimile machine refers to a facsimile machine that receives a DCN signal, a sending gateway refers to a gateway that is connected with the facsimile machine that sends a DCN signal, and a receiving gateway refers to a gateway connected with the facsimile machine that receives a DCN signal.
At present, a technical solution employed by a gateway of the prior art is illustrated in FIG. 3. A sending gateway, i.e., Gateway 1, detects V.21 frame signals demodulated and received on the Time Division Multiplexing (TDM) side. If a DCN signal is detected by Gateway 1, Gateway 1, acting as a sending gateway, packs the DCN signal into an IP Fax Protocol (IFP) packet and sends the IFP packet to the receiving gateway, i.e., Gateway 2. Aftr IFP packet signal is sent, Gateway 1 reports a fax end event to a Soft Switch. Upon the receipt of the end event, the Soft Switch confirms the end event and issues a fax end command to the sending and receiving gateways at the same time. After receiving the fax end command issued by the Soft Switch, the two gateways switch back to voice state respectively. In the solution shown in FIG. 1, the period for the gateways and the Soft Switch to exchange the fax end event and the switching command equals to the sum of the transmission delay of the fax end event from the sending gateway to the Soft Switch, the processing period of the Soft Switch and the transmission delay of the switching command from the Soft Switch to the sending/receiving gateways. The period for the DCN signal to integrally reach the receiving facsimile machine from the sending gateway equals to the sum of the IP transmission delay of the IFP packet of the DCN signal for reaching the receiving gateway, the processing period of unpacking, buffering and so on performed by the receiving gateway, and the transmission delay of the DCN signal on the PSTN line from the receiving gateway to the receiving facsimile machine. For example, in a NGN network with a good network condition, the period from the time when a gateway reports a Fax event to the time when a receiving gateway receives a switching command issued by a Soft Switch is only tens of milliseconds, usually no more than 100 ms. However, for an integral DCN signal from the sending gateway to the receiving facsimile machine, the transmission period on the PSTN line is at least 160 ms (DCN signal length: Frame Header 79 ms (3 bytes), HDLC Frame FCS Bytes: 53 ms (2 bytes), Trailing Sync Bytes: 26 ms (1 flags)). If the transmission delay of the DCN on the IP network and the processing period of the receiving gateway are taken into account, the period for the integral DCN signal from the sending gateway to the receiving facsimile machine at least reaches nearly 200 ms. Thus, this technical solution may result in the case that the receiving gateway may receive a fax end command issued by the Soft Switch during sending a DCN signal to the receiving facsimile machine or before sending the DCN signal, and switch its state from Fax state to voice state. As a result, the receiving facsimile machine cannot receive a valid DCN signal, which causes the receiving facsimile machine to think that the Fax terminates abnormally and to send out an alarm sound. This misleads the Fax user into thinking that the Fax fails.
Another technical solution employed by a gateway of the prior art is illustrated in FIG. 4. During a T.38 Fax service, Gateway 2 detects data on the IP side (i.e., the side between Gateway 1 and Gateway 2). If a DCN frame signal is received by Gateway 2, Gateway 2 modulates the DCN signal and sends the modulated one to the receiving facsimile machine. After sending the modulated DCN signal, Gateway 2 reports a fax end event to a Soft Switch, so as to ensure the DCN signal to successfully reach the receiving facsimile machine. This technical solution switches Fax state to voice state depending on the IP-side signal, and does not support the TDM-side DCN signal detection and report. This technical solution has the following disadvantages: 1) since the two gateways employ different DCN detecting and reporting mechanisms, if the sending gateway employs this solution, no DCN signal will be received on the IP side, and at this point, if the receiving gateway only detects on the TDM side, no fax end event will be reported to the Soft Switch when a Fax is ended; 2) if the sending gateway employs the former technical solution, the disadvantages of the former technical solution may also appear; and thus result in the situation that the receiving facsimile machine cannot receive a valid DCN signal.